package com.fluidops.datacatalog.reltables.sim;

import java.util.Collection;

import com.fluidops.datacatalog.reltables.model.Entity;
import com.fluidops.datacatalog.reltables.sim.entity.IEntitySimilarity;

public abstract class EntitySetSimilarity {

	private IEntitySimilarity entitySim;

	protected EntitySetSimilarity(IEntitySimilarity entitySim){
		this.entitySim = entitySim;
	}

	public abstract double calcEntitySetSimilarity(Collection<Entity> es1, Collection<Entity> es2);

	protected double applyEntitySimilarityMeasure(Collection<Entity> es1, Collection<Entity> es2){
		double similarity = 0;

		for(Entity e1 : es1){
			for(Entity e2 : es2){
				similarity += this.entitySim.calcEntitySimilarity(e1, e2);
			}
		}

		return similarity;
	}
}
